<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class OpenPlatform extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $sql = <<<SQL
        create table open_platform
        (
            `id` int unsigned not null auto_increment,
            `app` VARCHAR (255) NOT NULL comment 'app 名称',
            `app_id` varchar(40) not null comment ' 公众号id',
            `refresh_token` VARCHAR (255) DEFAULT NULL COMMENT 'token',
            `update_time` timestamp not null default current_timestamp on update current_timestamp,
            primary key (`id`)
        ) engine='innodb' DEFAULT CHARSET 'utf8mb4'
SQL;
        if (!DB::statement($sql)) {
            throw new \Exception("failed on execute SQL: [{$sql}]");
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        throw new \Exception('downgrade is forbidden');
    }
}
